package com.frozenc.domain;

import com.frozenc.enums.UserType;
import org.hibernate.validator.constraints.Email;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;

/**
 * Created by FrozenC on 2016/9/8.
 */
public class User  implements Serializable {

    private static final long serialVersionUID = 8809101560720973267L;

    private Integer id;

    @NotNull(message="名字不能为空")
    private String username;

    @Size(max = 20,min = 6,message="密码长度至少为6,不能超过20")
    private String password;

    @Size(max = 100,message = "个性签名过长")
    private String motto;

    private String email;

    private UserType userType;

    private String salt;

    @Override
    public String toString() {
        return "User [id=" + id + ", username=" + username + ", motto=" + motto + ", email=" + email + ", UserType=" + userType.getName() + "]";
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getMotto() {
        return motto;
    }

    public void setMotto(String motto) {
        this.motto = motto;
    }

    @Email(message = "邮箱格式错误")
    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public UserType getUserType() {
        return userType;
    }

    public void setUserType(UserType userType) {
        this.userType = userType;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getSalt() {
        return salt;
    }

    public void setSalt(String salt) {
        this.salt = salt;
    }
}
